Change GtkToolItem to retrieve its properties from GtkToolShell interface,
authorMathias Hasselmann <hasselmm@src.gnome.org>
Fri, 14 Dec 2007 10:57:46 +0000 (10:57 +0000)
committerMathias Hasselmann <hasselmm@src.gnome.org>
Fri, 14 Dec 2007 10:57:46 +0000 (10:57 +0000)
instead of relying on being child of a GtkToolbar. (#5034079)

* gtk/gtk.symbols, docs/reference/gtk/gtk-docs.sgml,
docs/reference/gtk/gtk-sections.txt: Add GtkToolShell symbols.
* docs/reference/gtk/tmpl/gtktoolitem.sgml: Move section docs inline.
* gtk/gtktoolbar.c: Implement GtkToolShellIface.
* gtk/gtktoolbar.h: Remove _gtk_toolbar_rebuild_menu.
* gtk/gtktoolitem.c: Use GtkToolShell, instead of GtkToolbar.
Take section docs from template file and update them for GtkToolShell.
* gtk/Makefile.am: Add gtk/gtktoolshell.c and gtk/gtktoolshell.h.
* gtk/gtktoolshell.c, gtk/gtktoolshell.h: New GtkToolShellIface.

svn path=/trunk/; revision=19177

ChangeLog
docs/reference/gtk/gtk-docs.sgml
docs/reference/gtk/gtk-sections.txt
docs/reference/gtk/tmpl/gtktoolitem.sgml
gtk/Makefile.am
gtk/gtk.symbols
gtk/gtktoolbar.c
gtk/gtktoolbar.h
gtk/gtktoolitem.c
gtk/gtktoolshell.c [new file with mode: 0644]
gtk/gtktoolshell.h [new file with mode: 0644]

index d53bfb14d0072900d97cb7c43682965b50bf69f7..d758c0a4880a4ffa4e0f92296bc6905d7701579c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2007-12-14  Mathias Hasselmann  <mathias@openismus.com>
+
+       Change GtkToolItem to retrieve its properties from GtkToolShell
+       interface, instead of relying on being child of a GtkToolbar.
+       (#5034079)
+
+       * gtk/gtk.symbols, docs/reference/gtk/gtk-docs.sgml,
+       docs/reference/gtk/gtk-sections.txt: Add GtkToolShell symbols.
+       * docs/reference/gtk/tmpl/gtktoolitem.sgml: Move section docs inline.
+       * gtk/gtktoolbar.c: Implement GtkToolShellIface.
+       * gtk/gtktoolbar.h: Remove _gtk_toolbar_rebuild_menu.
+       * gtk/gtktoolitem.c: Use GtkToolShell, instead of GtkToolbar.
+       Take section docs from template file and update them for GtkToolShell.
+       * gtk/Makefile.am: Add gtk/gtktoolshell.c and gtk/gtktoolshell.h.
+       * gtk/gtktoolshell.c, gtk/gtktoolshell.h: New GtkToolShellIface.
+
 2007-12-14  Mathias Hasselmann  <mathias@openismus.com>
 
        Extract loading of GtkPageSetup and GtkPrintSettings from their
index 114e143ef77f419e2be954d963d4ddec37d51426..0fa1200acddb786e111d0197b48cfa38eaf38a7d 100644 (file)
 <!ENTITY GtkToggleAction SYSTEM "xml/gtktoggleaction.xml">
 <!ENTITY GtkToggleButton SYSTEM "xml/gtktogglebutton.xml">
 <!ENTITY GtkToggleToolButton SYSTEM "xml/gtktoggletoolbutton.xml">
+<!ENTITY GtkToolShell SYSTEM "xml/gtktoolshell.xml">
 <!ENTITY GtkToolbar SYSTEM "xml/gtktoolbar.xml">
 <!ENTITY GtkToolButton SYSTEM "xml/gtktoolbutton.xml">
 <!ENTITY GtkToolItem SYSTEM "xml/gtktoolitem.xml">
     <releaseinfo>for GTK+ &version;</releaseinfo>
   </bookinfo>
 
+<!--
   <part id="gtk">
     <title>GTK+ Overview</title>
     <partintro>
@@ -441,7 +443,7 @@ that is, GUI components such as #GtkButton or #GtkTextView.
         &GtkListStore;
         &GtkTreeStore;
     </chapter>
-
+-->
     <chapter id="MenusAndCombos">
       <title>Menus, Combo Box, Toolbar</title>
        &GtkComboBox;
@@ -454,6 +456,7 @@ that is, GUI components such as #GtkButton or #GtkTextView.
         &GtkCheckMenuItem;      
         &GtkSeparatorMenuItem;
         &GtkTearoffMenuItem;
+        &GtkToolShell;
         &GtkToolbar;
         &GtkToolItem;
         &GtkSeparatorToolItem;
@@ -462,7 +465,7 @@ that is, GUI components such as #GtkButton or #GtkTextView.
         &GtkToggleToolButton;
         &GtkRadioToolButton;
     </chapter>
+<!--
     <chapter id="Actions">
       <title>Action-based menus and toolbars</title>
         &GtkUIManager;
@@ -684,5 +687,5 @@ that is, GUI components such as #GtkButton or #GtkTextView.
   <index role="2.12">
     <title>Index of new symbols in 2.12</title>
   </index>  
-
+-->
 </book>
index 11ac490a50273199ef66114870d836b560b9208e..f557f878e777fcec4bb70b072630fb18294a32ec 100644 (file)
@@ -3926,6 +3926,21 @@ GTK_TOGGLE_BUTTON_GET_CLASS
 gtk_toggle_button_get_type
 </SECTION>
 
+<SECTION>
+<FILE>gtktoolshell</FILE>
+<TITLE>GtkToolShell</TITLE>
+GtkToolShell
+GtkToolShellIface
+gtk_tool_shell_get_icon_size
+gtk_tool_shell_get_orientation
+gtk_tool_shell_get_relief_style
+gtk_tool_shell_get_style
+gtk_tool_shell_rebuild_menu
+
+<SUBSECTION Private>
+gtk_tool_shell_get_type
+</SECTION>
+
 <SECTION>
 <FILE>gtktoolbar</FILE>
 <TITLE>GtkToolbar</TITLE>
@@ -6691,3 +6706,4 @@ GTK_PAGE_SETUP_UNIX_DIALOG_GET_CLASS
 GtkPageSetupUnixDialogPrivate
 gtk_page_setup_unix_dialog_get_type
 </SECTION>
+
index faad98970505c913b8a72fea301d6651b77d58f7..ee97752dc7b44183ead41405f2f24fbdd6295374 100644 (file)
@@ -2,21 +2,10 @@
 GtkToolItem
 
 <!-- ##### SECTION Short_Description ##### -->
-The base class of widgets that can be added to GtkToolbar
 
 <!-- ##### SECTION Long_Description ##### -->
 <para>
-#GtkToolItem<!-- -->s are widgets that can appear on a toolbar. To
-create a toolbar item that contain something else than a button, use
-gtk_tool_item_new(). Use gtk_container_add() to add a child
-widget to the tool item.
-</para>
-<para>
-For toolbar items that contain buttons, see the #GtkToolButton,
-#GtkToggleToolButton and #GtkRadioToolButton classes.
-</para>
-See the #GtkToolbar class for a description of the toolbar widget.
-<para>
+
 </para>
 
 <!-- ##### SECTION See_Also ##### -->
@@ -46,8 +35,7 @@ See the #GtkToolbar class for a description of the toolbar widget.
 
 <!-- ##### STRUCT GtkToolItem ##### -->
 <para>
-The GtkToolItem struct contains only private data. It should only be
-accessed through the functions described below.
+
 </para>
 
 
index 359d1c9cda5889741d25fb76ced3539eb9bb0ec0..5a19467b555fc2f9ad7594a8f9abf9c2b2785d66 100644 (file)
@@ -299,6 +299,7 @@ gtk_public_h_sources =          \
        gtktoolbar.h            \
        gtktoolbutton.h         \
        gtktoolitem.h           \
+       gtktoolshell.h          \
        gtktooltip.h            \
        gtktooltips.h           \
        gtktree.h               \
@@ -587,6 +588,7 @@ gtk_base_c_sources =            \
        gtktoolbar.c            \
        gtktoolbutton.c         \
        gtktoolitem.c           \
+       gtktoolshell.c          \
        gtktooltip.c            \
        gtktooltips.c           \
        gtktree.c               \
index 917c6e8ea908bbf0a169684c6565fa06f8e7442b..c3aace362b50d50bc57173e5d536aa7dd840395e 100644 (file)
@@ -4049,6 +4049,16 @@ gtk_toolbar_unset_style
 #endif
 #endif
 
+#if IN_HEADER(__GTK_TOOL_SHELL_H__)
+#if IN_FILE(__GTK_TOOL_SHELL_C__)
+gtk_tool_shell_get_icon_size
+gtk_tool_shell_get_orientation
+gtk_tool_shell_get_style
+gtk_tool_shell_get_relief_style
+gtk_tool_shell_rebuild_menu
+#endif
+#endif
+
 #if IN_HEADER(__GTK_TOOL_BUTTON_H__)
 #if IN_FILE(__GTK_TOOL_BUTTON_C__)
 gtk_tool_button_get_icon_name
index 8b5141129b8d3e43807429bc40d192c32da8ce9c..8b1caddb770a4aa0b80f5280a4b35389431be8fa 100644 (file)
@@ -34,6 +34,7 @@
 #include <config.h>
 #include "gtkarrow.h"
 #include "gtktoolbar.h"
+#include "gtktoolshell.h"
 #include "gtkradiotoolbutton.h"
 #include "gtkseparatortoolitem.h"
 #include "gtkmenu.h"
@@ -299,12 +300,20 @@ static void            toolbar_content_hide_all             (ToolbarContent
 static void           toolbar_content_set_expand           (ToolbarContent      *content,
                                                             gboolean             expand);
 
+static void            toolbar_tool_shell_iface_init        (GtkToolShellIface   *iface);
+static GtkIconSize     toolbar_get_icon_size                (GtkToolShell        *shell);
+static GtkOrientation  toolbar_get_orientation              (GtkToolShell        *shell);
+static GtkToolbarStyle toolbar_get_style                    (GtkToolShell        *shell);
+static GtkReliefStyle  toolbar_get_relief_style             (GtkToolShell        *shell);
+static void            toolbar_rebuild_menu                 (GtkToolShell        *shell);
+
 #define GTK_TOOLBAR_GET_PRIVATE(o)  \
   (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_TOOLBAR, GtkToolbarPrivate))
 
 static guint                   toolbar_signals [LAST_SIGNAL] = { 0 };
 
-G_DEFINE_TYPE (GtkToolbar, gtk_toolbar, GTK_TYPE_CONTAINER)
+G_DEFINE_TYPE_WITH_CODE (GtkToolbar, gtk_toolbar, GTK_TYPE_CONTAINER,
+                         G_IMPLEMENT_INTERFACE (GTK_TYPE_TOOL_SHELL, toolbar_tool_shell_iface_init))
 
 static void
 add_arrow_bindings (GtkBindingSet   *binding_set,
@@ -336,6 +345,16 @@ add_ctrl_tab_bindings (GtkBindingSet    *binding_set,
                                GTK_TYPE_DIRECTION_TYPE, direction);
 }
 
+static void
+toolbar_tool_shell_iface_init (GtkToolShellIface *iface)
+{
+  iface->get_icon_size    = toolbar_get_icon_size;
+  iface->get_orientation  = toolbar_get_orientation;
+  iface->get_style        = toolbar_get_style;
+  iface->get_relief_style = toolbar_get_relief_style;
+  iface->rebuild_menu     = toolbar_rebuild_menu;
+}
+
 static void
 gtk_toolbar_class_init (GtkToolbarClass *klass)
 {
@@ -846,7 +865,7 @@ gtk_toolbar_unrealize (GtkWidget *widget)
     }
   
   if (GTK_WIDGET_CLASS (gtk_toolbar_parent_class)->unrealize)
-    (* GTK_WIDGET_CLASS (gtk_toolbar_parent_class)->unrealize) (widget);
+    GTK_WIDGET_CLASS (gtk_toolbar_parent_class)->unrealize (widget);
 }
 
 static gint
@@ -2527,14 +2546,14 @@ gtk_toolbar_forall (GtkContainer *container,
          GtkWidget *child = toolbar_content_get_widget (content);
          
          if (child)
-           (*callback) (child, callback_data);
+           callback (child, callback_data);
        }
       
       list = next;
     }
   
   if (include_internals)
-    (* callback) (priv->arrow_button, callback_data);
+    callback (priv->arrow_button, callback_data);
 }
 
 static GType
@@ -4932,10 +4951,34 @@ _gtk_toolbar_elide_underscores (const gchar *original)
   return result;
 }
 
-void
-_gtk_toolbar_rebuild_menu (GtkToolbar *toolbar)
+static GtkIconSize
+toolbar_get_icon_size (GtkToolShell *shell)
 {
-  GtkToolbarPrivate *priv = GTK_TOOLBAR_GET_PRIVATE (toolbar);
+  return GTK_TOOLBAR (shell)->icon_size;
+}
+
+static GtkOrientation
+toolbar_get_orientation (GtkToolShell *shell)
+{
+  return GTK_TOOLBAR (shell)->orientation;
+}
+
+static GtkToolbarStyle
+toolbar_get_style (GtkToolShell *shell)
+{
+  return GTK_TOOLBAR (shell)->style;
+}
+
+static GtkReliefStyle
+toolbar_get_relief_style (GtkToolShell *shell)
+{
+  return get_button_relief (GTK_TOOLBAR (shell));
+}
+
+static void
+toolbar_rebuild_menu (GtkToolShell *shell)
+{
+  GtkToolbarPrivate *priv = GTK_TOOLBAR_GET_PRIVATE (shell);
   GList *list;
 
   priv->need_rebuild = TRUE;
@@ -4947,7 +4990,7 @@ _gtk_toolbar_rebuild_menu (GtkToolbar *toolbar)
       toolbar_content_set_unknown_menu_status (content);
     }
   
-  gtk_widget_queue_resize (GTK_WIDGET (toolbar));
+  gtk_widget_queue_resize (GTK_WIDGET (shell));
 }
 
 #define __GTK_TOOLBAR_C__
index dbe72a8167652d7608ec5f4b27de4fbdc794fac1..0a4652c74620145b09b09a491197d088ff60dc90 100644 (file)
@@ -175,7 +175,6 @@ void            _gtk_toolbar_paint_space_line       (GtkWidget       *widget,
                                                     GdkRectangle    *area,
                                                     GtkAllocation   *allocation);
 gint            _gtk_toolbar_get_default_space_size (void);
-void            _gtk_toolbar_rebuild_menu           (GtkToolbar      *toolbar);
 
 
 void       gtk_toolbar_set_icon_size   (GtkToolbar      *toolbar,
index 1916af938c911751d7edf8e1f0f3439b22fff912..0fcf93e7e162ab3a969fddc282b25672a2f0130d 100644 (file)
@@ -23,7 +23,7 @@
 #include <config.h>
 #include "gtktoolitem.h"
 #include "gtkmarshalers.h"
-#include "gtktoolbar.h"
+#include "gtktoolshell.h"
 #include "gtkseparatormenuitem.h"
 #include "gtkintl.h"
 #include "gtkmain.h"
 
 #include <string.h>
 
+/**
+ * SECTION:gtktoolitem
+ * @short_description: The base class of widgets that can be added to #GtkToolShell
+ *
+ * #GtkToolItem<!-- -->s are widgets that can appear on a toolbar. To
+ * create a toolbar item that contain something else than a button, use
+ * gtk_tool_item_new(). Use gtk_container_add() to add a child
+ * widget to the tool item.
+ *
+ * For toolbar items that contain buttons, see the #GtkToolButton,
+ * #GtkToggleToolButton and #GtkRadioToolButton classes.
+ *
+ * See the #GtkToolbar class for a description of the toolbar widget, and
+ * #GtkToolShell for a description of the tool shell interface.
+ */
+
+/**
+ * GtkToolItem:
+ *
+ * The GtkToolItem struct contains only private data.
+ * It should only be accessed through the functions described below.
+ */
+
 enum {
   CREATE_MENU_PROXY,
   TOOLBAR_RECONFIGURED,
@@ -192,10 +215,10 @@ gtk_tool_item_class_init (GtkToolItemClass *klass)
  * item is a child of changes. For custom subclasses of #GtkToolItem,
  * the default handler of this signal use the functions
  * <itemizedlist>
- * <listitem>gtk_toolbar_get_orientation()</listitem>
- * <listitem>gtk_toolbar_get_style()</listitem>
- * <listitem>gtk_toolbar_get_icon_size()</listitem>
- * <listitem>gtk_toolbar_get_relief_style()</listitem>
+ * <listitem>gtk_tool_shell_get_orientation()</listitem>
+ * <listitem>gtk_tool_shell_get_style()</listitem>
+ * <listitem>gtk_tool_shell_get_icon_size()</listitem>
+ * <listitem>gtk_tool_shell_get_relief_style()</listitem>
  * </itemizedlist>
  * to find out what the toolbar should look like and change
  * themselves accordingly.
@@ -518,10 +541,10 @@ gtk_tool_item_get_icon_size (GtkToolItem *tool_item)
   g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_ICON_SIZE_LARGE_TOOLBAR);
 
   parent = GTK_WIDGET (tool_item)->parent;
-  if (!parent || !GTK_IS_TOOLBAR (parent))
+  if (!parent || !GTK_IS_TOOL_SHELL (parent))
     return GTK_ICON_SIZE_LARGE_TOOLBAR;
 
-  return gtk_toolbar_get_icon_size (GTK_TOOLBAR (parent));
+  return gtk_tool_shell_get_icon_size (GTK_TOOL_SHELL (parent));
 }
 
 /**
@@ -545,10 +568,10 @@ gtk_tool_item_get_orientation (GtkToolItem *tool_item)
   g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_ORIENTATION_HORIZONTAL);
 
   parent = GTK_WIDGET (tool_item)->parent;
-  if (!parent || !GTK_IS_TOOLBAR (parent))
+  if (!parent || !GTK_IS_TOOL_SHELL (parent))
     return GTK_ORIENTATION_HORIZONTAL;
 
-  return gtk_toolbar_get_orientation (GTK_TOOLBAR (parent));
+  return gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (parent));
 }
 
 /**
@@ -588,10 +611,10 @@ gtk_tool_item_get_toolbar_style (GtkToolItem *tool_item)
   g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_TOOLBAR_ICONS);
 
   parent = GTK_WIDGET (tool_item)->parent;
-  if (!parent || !GTK_IS_TOOLBAR (parent))
+  if (!parent || !GTK_IS_TOOL_SHELL (parent))
     return GTK_TOOLBAR_ICONS;
 
-  return gtk_toolbar_get_style (GTK_TOOLBAR (parent));
+  return gtk_tool_shell_get_style (GTK_TOOL_SHELL (parent));
 }
 
 /**
@@ -616,10 +639,10 @@ gtk_tool_item_get_relief_style (GtkToolItem *tool_item)
   g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_RELIEF_NONE);
 
   parent = GTK_WIDGET (tool_item)->parent;
-  if (!parent || !GTK_IS_TOOLBAR (parent))
+  if (!parent || !GTK_IS_TOOL_SHELL (parent))
     return GTK_RELIEF_NONE;
 
-  return gtk_toolbar_get_relief_style (GTK_TOOLBAR (parent));
+  return gtk_tool_shell_get_relief_style (GTK_TOOL_SHELL (parent));
 }
 
 /**
@@ -1095,8 +1118,8 @@ gtk_tool_item_rebuild_menu (GtkToolItem *tool_item)
 
   widget = GTK_WIDGET (tool_item);
   
-  if (widget->parent && GTK_IS_TOOLBAR (widget->parent))
-    _gtk_toolbar_rebuild_menu (GTK_TOOLBAR (widget->parent));
+  if (widget->parent && GTK_IS_TOOL_SHELL (widget->parent))
+    gtk_tool_shell_rebuild_menu (GTK_TOOL_SHELL (widget->parent));
 }
 
 /**
diff --git a/gtk/gtktoolshell.c b/gtk/gtktoolshell.c
new file mode 100644 (file)
index 0000000..2eab8bb
--- /dev/null
@@ -0,0 +1,159 @@
+/* gtktoolshell.c
+ * Copyright (C) 2007  Openismus GmbH
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author:
+ *   Mathias Hasselmann
+ */
+
+#include <config.h>
+#include "gtktoolshell.h"
+#include "gtkwidget.h"
+#include "gtkintl.h"
+#include "gtkalias.h"
+
+/**
+ * SECTION:gtktoolshell
+ * @short_description: Interface for containers containing #GtkToolItem widgets.
+ *
+ * The #GtkToolShell interface allows container widgets to provide additional
+ * information when embedding #GtkToolItem widgets.
+ *
+ * @see_also: #GtkToolbar, #GtkToolItem
+ */
+
+/**
+ * GtkToolShell:
+ *
+ * Dummy structure for accessing instances of #GtkToolShellIface.
+ */
+
+GType
+gtk_tool_shell_get_type (void)
+{
+  static GType type = 0;
+
+  if (!type)
+    {
+      type = g_type_register_static_simple (G_TYPE_INTERFACE, I_("GtkToolShell"),
+                                            sizeof (GtkToolShellIface),
+                                            NULL, 0, NULL, 0);
+      g_type_interface_add_prerequisite (type, GTK_TYPE_WIDGET);
+    }
+
+  return type;
+}
+
+/**
+ * gtk_tool_shell_get_icon_size:
+ * @shell: a #GtkToolShell
+ *
+ * Retrieves the icon size for the tool shell. Tool items must not call this
+ * function directly, but rely on gtk_tool_item_get_icon_size() instead.
+ *
+ * Return value: the current size for icons of @shell
+ *
+ * Since: 2.16
+ **/
+GtkIconSize
+gtk_tool_shell_get_icon_size (GtkToolShell *shell)
+{
+  return GTK_TOOL_SHELL_GET_IFACE (shell)->get_icon_size (shell);
+}
+
+/**
+ * gtk_tool_shell_get_orientation:
+ * @shell: a #GtkToolShell
+ *
+ * Retrieves the current orientation for the tool shell. Tool items must not
+ * call this function directly, but rely on gtk_tool_item_get_orientation()
+ * instead.
+ *
+ * Return value: the current orientation of @shell
+ *
+ * Since: 2.16
+ **/
+GtkOrientation
+gtk_tool_shell_get_orientation (GtkToolShell *shell)
+{
+  return GTK_TOOL_SHELL_GET_IFACE (shell)->get_orientation (shell);
+}
+
+/**
+ * gtk_tool_shell_get_style:
+ * @shell: a #GtkToolShell
+ *
+ * Retrieves whether the tool shell has text, icons, or both. Tool items must
+ * not call this function directly, but rely on gtk_tool_item_get_style()
+ * instead.
+ *
+ * Return value: the current style of @shell
+ *
+ * Since: 2.16
+ **/
+GtkToolbarStyle
+gtk_tool_shell_get_style (GtkToolShell *shell)
+{
+  return GTK_TOOL_SHELL_GET_IFACE (shell)->get_style (shell);
+}
+
+/**
+ * gtk_tool_shell_get_relief_style:
+ * @shell: a #GtkToolShell
+ *
+ * Returns the relief style of buttons on @shell. Tool items must not call this
+ * function directly, but rely on gtk_tool_item_get_relief_style() instead.
+ *
+ * Return value: The relief style of buttons on @shell.
+ *
+ * Since: 2.16
+ **/
+GtkReliefStyle
+gtk_tool_shell_get_relief_style (GtkToolShell *shell)
+{
+  GtkToolShellIface *iface = GTK_TOOL_SHELL_GET_IFACE (shell);
+
+  if (iface->get_relief_style)
+    iface->get_relief_style (shell);
+
+  return GTK_RELIEF_NONE;
+}
+
+/**
+ * gtk_tool_shell_rebuild_menu:
+ * @shell: a #GtkToolShell
+ *
+ * Calling this function signals the tool shell that the overflow menu item for
+ * tool items have changed. If there is an overflow menu and if it is visible
+ * when this function it called, the menu will be rebuilt.
+ *
+ * Tool items must not call this function directly, but rely on
+ * gtk_tool_item_rebuild_menu() instead.
+ *
+ * Since: 2.16
+ **/
+void
+gtk_tool_shell_rebuild_menu (GtkToolShell *shell)
+{
+  GtkToolShellIface *iface = GTK_TOOL_SHELL_GET_IFACE (shell);
+
+  if (iface->rebuild_menu)
+    iface->rebuild_menu (shell);
+}
+
+#define __GTK_TOOL_SHELL_C__
+#include "gtkaliasdef.c"
diff --git a/gtk/gtktoolshell.h b/gtk/gtktoolshell.h
new file mode 100644 (file)
index 0000000..684ad89
--- /dev/null
@@ -0,0 +1,71 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2007  Openismus GmbH
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author:
+ *   Mathias Hasselmann
+ */
+
+#ifndef __GTK_TOOL_SHELL_H__
+#define __GTK_TOOL_SHELL_H__
+
+#include <gtk/gtkenums.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_TOOL_SHELL            (gtk_tool_shell_get_type ())
+#define GTK_TOOL_SHELL(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TOOL_SHELL, GtkToolShell))
+#define GTK_IS_TOOL_SHELL(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TOOL_SHELL))
+#define GTK_TOOL_SHELL_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_TOOL_SHELL, GtkToolShellIface))
+
+typedef struct _GtkToolShell           GtkToolShell; /* dummy typedef */
+typedef struct _GtkToolShellIface      GtkToolShellIface;
+
+/**
+ * GtkToolShellIface:
+ * @get_icon_size:    mandatory implementation of gtk_tool_shell_get_icon_size().
+ * @get_orientation:  mandatory implementation of gtk_tool_shell_get_orientation().
+ * @get_style:        mandatory implementation of gtk_tool_shell_get_style().
+ * @get_relief_style: optional implementation of gtk_tool_shell_get_relief_style().
+ * @rebuild_menu:     optional implementation of gtk_tool_shell_rebuild_menu().
+ *
+ * Virtual function table for the #GtkToolShell interface.
+ */
+struct _GtkToolShellIface
+{
+  /*< private >*/
+  GTypeInterface g_iface;
+
+  /*< public >*/
+  GtkIconSize     (*get_icon_size)    (GtkToolShell *shell);
+  GtkOrientation  (*get_orientation)  (GtkToolShell *shell);
+  GtkToolbarStyle (*get_style)        (GtkToolShell *shell);
+  GtkReliefStyle  (*get_relief_style) (GtkToolShell *shell);
+  void            (*rebuild_menu)     (GtkToolShell *shell);
+};
+
+GType           gtk_tool_shell_get_type         (void) G_GNUC_CONST;
+
+GtkIconSize     gtk_tool_shell_get_icon_size    (GtkToolShell *shell);
+GtkOrientation  gtk_tool_shell_get_orientation  (GtkToolShell *shell);
+GtkToolbarStyle gtk_tool_shell_get_style        (GtkToolShell *shell);
+GtkReliefStyle  gtk_tool_shell_get_relief_style (GtkToolShell *shell);
+void            gtk_tool_shell_rebuild_menu     (GtkToolShell *shell);
+
+G_END_DECLS
+
+#endif /* __GTK_TOOL_SHELL_H__ */